package com.wei.czz.common.vo.admin.menu;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.wei.czz.common.constant.Constant;
import com.wei.czz.common.constant.RedisConstant;
import com.wei.czz.common.constant.EntityConstant;
import com.wei.czz.common.jsr303.group.OrderSearch;
import com.wei.czz.common.vo.common.BaseVo;
import lombok.*;

import javax.validation.constraints.NotNull;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2021-05-02 12:12:00
 * className: MenuFromVo 菜单管理页面请求表单Vo类
 * version: 1.1
 * description:
 */
@Getter
@Setter
public class MenuFormVo extends BaseVo {

    /**
     * 查询数据类型[true-已缓存数据 false-未缓存数据]
     */
    @NotNull(message = "查询数据类型不能为空", groups = { OrderSearch.class })
    private Boolean cacheStatus;

    /**
     * 父级主键
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    /**
     * 菜单类型[0-目录 1-页面 2-按钮]
     */
    private Integer type;

    /**
     * 菜单-菜单是否显示[0-显示 1-隐藏]
     */
    private Integer display;

    /**
     * 菜单-状态[0-可用 1-不可用]
     */
    private Integer status;

    /**
     * 获取Redis-String缓存键
     */
    @JsonIgnore
    public String getMenuListKey() {
        return RedisConstant.STRING + EntityConstant.MENU + Constant.UNDER + RedisConstant.LIST + word
                + RedisConstant.SPLIT + parentId + Constant.SPLIT + type + Constant.SPLIT + display
                + RedisConstant.SPLIT + status + RedisConstant.SPLIT + page + RedisConstant.SPLIT + limit;
    }

}
